package cn.codeforfun.initialization.project;

import cn.codeforfun.initialization.common.Pagination;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author wangbin
 */
@RestController
public class ProjectController {
    @Resource
    private ProjectService projectService;

    @PostMapping("/listProject")
    public Pagination<Project> listProject(@RequestBody Pagination<Project> pagination) {
        return projectService.listProject(pagination);
    }

    @GetMapping("/getProject/{id}")
    public Project getProject(@PathVariable Integer id) {
        return projectService.getProject(id);
    }

    @PostMapping("/saveProject")
    public void saveProject(@RequestBody Project project) {
        projectService.saveProject(project);
    }

    @GetMapping("/checkProjectName/{name}")
    public boolean checkProjectName(@PathVariable String name) {
        return projectService.checkProjectName(name);
    }

    @DeleteMapping("/deleteProject/{id}")
    public boolean deleteProject(@PathVariable Integer id) {
        return projectService.deleteProject(id);
    }
}
